{% set visible = options.visible is defined ? options.visible : true %}

{% if visible %}
    <div>
        {% if action.label %}
            <span class="dropdown-header">{{ action.label|trans }}</span>
        {% endif %}

        {% for link in options.links|default %}
            {% set is_link_visible = link.visible is defined ? link.visible : true %}

            {% if is_link_visible %}
                {% set path = link.url is defined ? link.url : path(link.route, link.parameters|default([])) %}
                <a class="dropdown-item" href="{{ path }}">
                    {% if link.icon is defined %}
                        {{ ux_icon(link.icon, {'class': 'icon dropdown-item-icon' }) }}
                    {% endif %}
                    {{ link.label|trans }}
                </a>
            {% endif %}
        {% endfor %}
    </div>
{% endif %}
